﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.effects.Particle {
    import Engine.Helpers.*;
    import Classes.*;

    public class TrainSmokeEffect extends ParticleEffect {

        private static const EFFECT_NAME:String = "trainSmoke";
        private static const BASE_SPAWN_PERIOD:Number = 1;
        private static const TRAIN_SPEED_MULT:Number = 0.8;

        private var m_trainMaxSpeed:Number = 1;
        private var m_smokeOffset:Vector2;

        public function TrainSmokeEffect(_arg1:MapResource){
            var _local2:Train;
            var _local3:XMLList;
            super(_arg1, EFFECT_NAME);
            spawnPeriod = BASE_SPAWN_PERIOD;
            minVel = 10;
            maxVel = 25;
            minAngle = 0xFF;
            maxAngle = 285;
            minDuration = 1.5;
            maxDuration = 4;
            minRotationVel = 0;
            maxRotationVel = 0;
            loopParticleAnimation = false;
            if (((_arg1) && ((_arg1 is Train)))){
                _local2 = (_arg1 as Train);
                _local3 = _local2.getItem().smokeXml;
                this.m_trainMaxSpeed = _local2.getItem().navigateXml.runSpeed;
                this.m_smokeOffset = new Vector2(_local3.@offsetX, _local3.@offsetY);
            };
        }
        override protected function getTargetOffset():Vector2{
            if (this.m_smokeOffset){
                return (this.m_smokeOffset);
            };
            return (new Vector2(0, 0));
        }
        public function adjustForTrainSpeed(_arg1:Number):void{
            spawnPeriod = (BASE_SPAWN_PERIOD - ((_arg1 / this.m_trainMaxSpeed) * TRAIN_SPEED_MULT));
        }

    }
}//package Classes.effects.Particle 
